package net.pimpas.web.jsf.components;

import javax.faces.component.UIComponentBase;
import javax.faces.context.FacesContext;

public abstract class UIComponentPimpasBase extends UIComponentBase {

	private String styleClass;
	private String style;
	private Boolean noId;
	private String tabIndex;
	private String align;

	public static final String COMPONENTS_RESOURCE_PATH		= UIComponentPimpasBase.class.getPackage().getName();
	
	@Override
	public Object saveState(FacesContext context) {
		Object[] ob = new Object[6];
		ob[0] = super.saveState(context);
		ob[1] = this.getStyleClass();
		ob[2] = this.getStyle();
		ob[3] = this.getNoId();
		ob[4] = this.getTabIndex();
		ob[5] = this.getAlign();
		
		return ob;
	}
	
	public abstract String getRendererType( );
	
	@Override
	public void restoreState(FacesContext context, Object state) {
		Object[] ob = (Object[]) state;
		super.restoreState(context, ob[0]);
		this.setStyleClass((String) ob[1]);
		this.setStyle((String) ob[2]);
		this.setNoId((Boolean) ob[3]);
		this.setTabIndex((String) ob[4]);
		this.setAlign((String) ob[5]);
	}
	
	
	public String getStyle() {
		return style;
	}
	public void setStyle(String style) {
		this.style = style;
	}
	public String getStyleClass() {
		return styleClass;
	}
	public void setStyleClass(String styleClass) {
		this.styleClass = styleClass;
	}

	public Boolean getNoId() {
		return noId;
	}

	public void setNoId(Boolean noId) {
		this.noId = noId;
	}

	public String getTabIndex() {
		return tabIndex;
	}

	public void setTabIndex(String tabIndex) {
		this.tabIndex = tabIndex;
	}

	public String getAlign() {
		return align;
	}

	public void setAlign(String align) {
		this.align = align;
	}
}